package com.leetcode.No0011;

import java.util.HashMap;

/**
 * @program: leetcode
 * @description:
 * @author: wangzhihua
 * @date: 2021-05-27
 */
public class Solution01 {

	public int maxArea(int[] height) {
		int leftInd = 0;
		int rightInd = height.length - 1;

		int ans = 0;

		while (leftInd < rightInd) {
			ans = Math.max(ans, (Math.min(height[leftInd], height[rightInd]) * (rightInd - leftInd)));

			if(height[leftInd] < height[rightInd]) {
				++leftInd;
			} else {
				--rightInd;
			}
		}
		return ans;
	}

}
